<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
/**（laravel 浅谈部分）
 * Auth::loginUsingId(1);
Route::get('/', function () {
    $user = \App\User::find(1);
    event(new \App\Events\UserSigUp($user));
    //    return view('welcome');
});
Route::get('/', function (){
    return view('welcome');
});
Route::get('/lessons', function (){
    $lessons = \App\Post::latest()->paginate(6);
    return view('lesson.index', compact('lessons'));
});
Route::group(['prefix' => 'admin', 'middleware' => 'admin'], function (){
    Route::get('/users', function (){
        return 'admin only';
    });
});
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');


/*laravel  核心概念理解部分*/
/**
class Baz {}

class Bar {
    public $baz;
    public function __construct(Baz $baz) {
        $this->baz = $baz;
    }
}
class Foo {
    public $bar;
    public function __construct(Bar $bar) {
        $this->bar = $bar;
    }
}
App::bind('Foo', function (){
    return new Foo(new Bar(new Baz()));
});

Route::get('/', function (){
    $foo = new Foo( new Bar( new Baz()));
    dd($foo);
});
 * */
Route::get('/', function (){
//    dd(Hash::make('password'));
//    dd(app('hash')->make('password'));
//    dd(app()['hash']->make('password'));
//    dd(app('Illuminate\Hashing\BcryptHasher')->make('password'));
    return view('welcome');
});


